import request from './request'

const baseURL = import.meta.env.VITE_API_URL

export const characterAPI = {
    async createCharacter(data) {
        return request.post(baseURL + '/characters', data)
    },
    async deleteCharacter(characterId) {
        return request.delete(baseURL + `/characters/${characterId}`)
    },
    async getCharacter(characterId) {
        return request.get(baseURL + `/characters/${characterId}`)
    },
    async listCharacters(cursor = null, pageSize = 10,my_characters = false) {
        return request.get(baseURL + `/characters`,{
            params: {
                cursor,
                page_size: pageSize,
                my_characters
            }
        })
    },
    async updateCharacter(characterId, data) {
        return request.put(baseURL + `/characters/${characterId}`, data)
    }
}